<template>
	<view>
		<global-contact></global-contact>
		<view class="list">
			<view class="item" @click="posterDetail(item)" style="margin-right: 30rpx;" v-for="(item,index) in posterList" :key="index">
				<image :src="showImg+item.img" mode="aspectFill"></image>
				<view class="title">{{item.title}}</view>
				<view class="des">{{item.poster_use_count}}人正在使用</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { getPoster } from '@/utils/request.js' 
	export default {
		data() {
			return {
				showImg:'',
				posterList:[],
			}
		},
		methods: {
			posterDetail(item){
				uni.navigateTo({
					url:'./posterDetail?id='+item.id
				})
			},
			async getPoster(data){
				return await getPoster(data)
			}, 
			getList(){
				let data={
					p:0,
					n:20, 
				}
				this.getPoster(data).then(res=>{
					console.log('海报信息',res)
					if(res.list&&res.list.length>0){
						this.posterList=res.list
						// this.posterList=[...res.list,...res.list,...res.list,...res.list,...res.list]
					}
				})
			}
		},
		onLoad() {
			this.showImg=this.$config.showImgApi; 
			this.getList()
		}
	}
</script>

<style lang="scss">
	.list{
			display: flex;
			justify-content: flex-start;
			align-items: center;
			flex-flow: row wrap;
			padding: 20rpx 36rpx;
			.item{
				display: flex;
				justify-content: flex-start;
				align-items: center;
				flex-direction: column; 
				margin-bottom: 30rpx;
				margin-right: 20;
				image{
					width: 206rpx;
					height: 252rpx;
				}
				.title{
					text-align: center;
					font-size: 26rpx;
					font-family: 苹方-简;
					font-weight: normal;
					line-height: 34rpx;
					color: #1A1A1A;
					margin: 12rpx 0 14rpx;
				}
				.des{
					font-size: 22rpx;
					font-family: 苹方-简;
					font-weight: normal;
					line-height: 30rpx;
					color: #999999;
				}
			} 
			.item:nth-child(3n){
				margin-right: 0!important;
			}
		}
</style>
